<template>
  <page-body>
    <view class="page">
      <view class="flex flex-direction align-stretch justify-between benben-position-layout flex searchRow_flex_0"
        :style="{height:(93+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between searchRow_fd0_0'>
          <text class='fu-iconfont2  searchRow_fd0_0_c0' @tap.stop="handleJumpDiy"  data-type="back"
             data-url="1">&#xe794;</text>
          <view class='flex flex-wrap align-center flex-sub searchRow_fd0_0_c1'>
            <benben-input class='flex-sub searchRow_fd0_0_c1_c0' type="text" :placeholder="`请输入关键字`" confirm-type="done"
              :maxlength="-1" placeholder-style="color:#999;font-size:24rpx" @focus="navSearchFunc()"
              v-model="KeyWord" />
          </view>
          <image class='searchRow_fd0_0_c2' mode="aspectFit" :src='STATIC_URL+"guofang/64.png"' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pageguofang/honoDeta/search/search`"></image>
        </view>

      </view>
       <view :style="{height: (93+StatusBarRpx)+'rpx'}"></view>
      <!--
      <view class="flex benben-flex-layout flex-wrap align-center">
        <view>
          <benben-flex-tabs class-name='searchRow_benbenTabsfd1_0' v-model="tabsLop" ref="benben_tabsfd1_0"
            select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false' :open-sticky='true' :top='0'
            :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd1_0"
            @change="tabsChangeFunc($event)">

            <scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
              class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left="tabsInfofd1_0.moveX"
              scroll-with-animation="all .3s ease">
              <view class="benben-tabs-content" id="benben_tabsfd1_0-content">
                <view id="benben_tabsfd1_0-title" class="benben-tabs-title flex flex align-center justify-around">
                  <template v-for='(item,key0) in tabs'>
                    <view :key='key0'
                      :class="{ 'checkTitlefd1_0': tabsLop == item.value, 'flex flex-wrap align-center': true }"
                      @tap="tabsLop = item.value" :id="`benben_tabsfd1_0-title-item-${item.value}`">

                      <text>{{item.name}}</text>

                    </view>
                  </template>
                </view>
                <view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
                  id="benben_tabsfd1_0-line" class="benben-tabs-line flex benben-flex-tabs-line searchRow_linefd1_0">
                </view>
              </view>
            </scroll-view>

          </benben-flex-tabs>

        </view>
      </view> -->

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout searchRow_flex_2">
        <template v-for='(item,key0) in list'>
          <view class='flex flex-wrap align-center justify-between searchRow_fd2_0' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pageguofang/guofang/particular/particular?aid=${item.aid}`" :key='key0'>
            <view class='flex flex-direction flex-wrap align-stretch justify-between searchRow_fd2_0_c0'>
              <text class='searchRow_fd2_0_c0_c0'>{{item.title}}</text>
              <text class='searchRow_fd2_0_c0_c1'>{{item.create_time}}</text>
            </view>
            <image class='searchRow_fd2_0_c1' mode="aspectFill" :src='item.thumb'></image>
          </view>
        </template>

        <benben-empty v-if="list.length==0">
          <view>
            <view class='flex flex-direction flex-wrap align-center searchRow_fd2_1'>
              <image class='searchRow_fd2_1_c0' mode="widthFix" :src='STATIC_URL+"guofang/35.png"'></image>
              <text class='searchRow_fd2_1_c1'>暂无数据</text>

            </view>
          </view>
        </benben-empty>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <!--   <view class="flex flex-wrap align-center justify-between benben-flex-layout searchRow_flex_3"
        v-if=" tabsShow===true">
        <template v-for='(item,key0) in listTo'>
          <view class='flex flex-direction flex-wrap align-stretch searchRow_fd3_0' :key='key0'
            @tap.stop="skip(item.aid)">
            <image class='searchRow_fd3_0_c0' mode="aspectFill" :src='item.thumb'></image>
            <text class='searchRow_fd3_0_c1' v-if=" item.is_study=='1'">必修</text>
            <view class='flex flex-direction flex-wrap align-stretch searchRow_fd3_0_c2'>
              <text class='searchRow_fd3_0_c2_c0'>{{item.name}}</text>
              <view class='flex flex-wrap align-center searchRow_fd3_0_c2_c1'>
                <text>共</text>
                <text>{{item.chapter_num}}</text>
                <text>章节</text>
              </view>
            </view>
          </view>
        </template>

      </view> -->

      <!---flex布局flex布局结束-->


    </view>
  </page-body>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "tabsInfofd1_0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "KeyWord": "",
        "list": [],
        "tabsShow": false,
        "listTo": [],
        "tabsLop": "1",
        "tabs": [{
          "name": "新闻资讯",
          "value": "1",
          "image": ""
        }, {
          "name": "课程资源",
          "value": "2",
          "image": ""
        }],
        "keyword": "",
        tabsLopShow: false
      };
    },
    computed: {

    },
    watch: {},
    onLoad(options) {
      let {
        keyword,
        are
      } = options
      if (keyword !== undefined) this.keyword = keyword
      if (are !== undefined) this.tabsLop = 2
      // setTimeout(()=>{
      //   this.tabsLopShow = true
      // },500)
      this.tabsLopShow = true
      this.KeyWord = keyword
      this.getmessageFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
    this.getmessageFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    onBackPress(e) {
      // console.log("e=>",e)
      // if(e.from=="backbutton"){
      //   uni.reLaunch({
      //     url: "/pages/about/trends/trends"
      //   })
      // }

      //  return true;
    },
    methods: {
      /* 跳转课程详情*/
      skip(aid) {
        uni.navigateTo({
          url: "/pages/honoDeta/courseIns/courseIns?course_id=" + aid + "&navType=1"
        })
      },
      //跳转页面
      navSearchFunc() {
        this.$urouter.navigateTo(`/pageguofang/honoDeta/search/search`);
      },
      //tabs切换
      // tabsChangeFunc(val) {
      //   if (val == '1') {
      //     this.getmessageFunc()
      //     this.tabsShow = false;
      //   } else if (val == '2') {
      //     this.seraeListFunc()
      //     this.tabsShow = true;
      //   }
      // },
      //获取新闻资讯
      async getmessageFunc() {
        //请求方法
        //数据验证

        let datalist = await this.$api.get(global.apiUrls.post66bdaadbb332a, {
          // operationarticlecolumn_id: '10',
          // list_rows: '15',
          keyword: this.keyword
        });

        if (datalist.data.code != 1) {
          this.$message.info(datalist.data.msg);
          return
        }
        let infolist = datalist.data.data;
        this.list = infolist.data
        console.log("this.list=>", this.list)
      },
      //搜索课程列表
      async seraeListFunc() {
        //请求方法
        //数据验证

        let datalistTo = await this.$api.get(global.apiUrls.post64ae7e2f6ff93, {
          list_rows: '10',
          keyword: this.keyword
        });

        if (datalistTo.data.code != 1) {
          this.$message.info(datalistTo.data.msg);
          return
        }
        let infolistTo = datalistTo.data.data;
        this.listTo = infolistTo.data

      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F6f6f6;
    background-size: 100% auto;
  }

  .searchRow_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 93rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: #eee;
  }

  .searchRow_fd0_0_c2 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 0rpx 40rpx;
  }

  .searchRow_fd0_0_c1_c0 {
    font-size: 24rpx;
    font-weight: 400;
    color: #333;
  }

  .searchRow_fd0_0_c1 {
    background: rgba(249, 249, 249, 1);
    height: 64rpx;
    background-size: 100% auto !important;
    border-radius: 34rpx 34rpx 34rpx 34rpx;
    padding: 0rpx 24rpx 0rpx 24rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
  }

  .searchRow_fd0_0_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
    margin: 0rpx 34rpx 0rpx 0rpx;
  }

  .searchRow_fd0_0 {
    padding: 0rpx 24rpx 0rpx 35rpx;
    line-height: 93rpx;
  }

  .searchRow_linefd1_0 {
    background: #d53215;
    width: 100rpx;
    height: 8rpx;
    top: 80rpx;
    background-size: 100% auto !important;
  }

  .checkTitlefd1_0 {
    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #333 !important;
    background-color: rgba(255, 255, 255, 1) !important;
  }

  ::v-deep .searchRow_benbenTabsfd1_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
  }

  .searchRow_flex_2 {
    padding: 32rpx 24rpx 0rpx 24rpx;
  }

  .searchRow_fd2_1_c1 {
    padding: 30rpx 0rpx 0rpx 0rpx;
    color: #929292;
  }

  .searchRow_fd2_1_c0 {
    width: 312rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .searchRow_fd2_1 {
    width: 100%;
    padding: 50rpx 0rpx 50rpx 0rpx;
  }

  .searchRow_fd2_0_c1 {
    width: 258rpx;
    height: 160rpx;
    border-radius: 16rpx;
  }

  .searchRow_fd2_0_c0_c1 {
    font-size: 24rpx;
    color: rgba(153, 153, 153, 1);
  }

  .searchRow_fd2_0_c0_c0 {
    line-height: 40rpx;
    font-weight: 700;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .searchRow_fd2_0_c0 {
    width: 364rpx;
    height: 162rpx;
  }

  .searchRow_fd2_0 {
    border-bottom: 1px solid #eee;
    background: rgba(255, 255, 255, 1);
    margin: 0rpx 0rpx 32rpx 0rpx;
    padding: 32rpx 24rpx 32rpx 24rpx;
    border-radius: 16rpx;
    background-size: 100% auto;
  }

  .searchRow_flex_3 {
    padding: 24rpx;
  }

  .searchRow_fd3_0_c2_c1 {
    font-size: 24rpx;
    line-height: 33rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
  }

  .searchRow_fd3_0_c2_c0 {
    font-size: 28rpx;
    font-weight: 500;
    line-height: 40rpx;
    margin: 0rpx 0rpx 16rpx 0rpx;
    width: 100%;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .searchRow_fd3_0_c2 {
    padding: 16rpx 16rpx 07rpx 16rpx;
  }

  .searchRow_fd3_0_c1 {
    background: linear-gradient(180deg, #FF6648 0%, #FF8C49 100%);
    position: absolute;
    background-size: 100% auto;
    width: 88rpx;
    line-height: 33rpx;
    text-align: center;
    color: var(--benbenFontColor3);
    font-size: 24rpx;
    font-weight: 500;
    border-radius: 16rpx 0rpx 16rpx 0rpx;
  }

  .searchRow_fd3_0_c0 {
    width: 342rpx;
    height: 220rpx;
    border-radius: 16rpx 16rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 0rpx 0rpx;
  }

  .searchRow_fd3_0 {
    background: #fff;
    width: 342rpx;
    height: 342rpx;
    border-radius: 16rpx;
    background-size: 100% auto;
    margin: 0rpx 0rpx 16rpx 0rpx;
    position: relative;
  }
</style>
